using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.DynamicForm;

namespace QL.K3.SCM.SAL.CLIENT.BusinessPlugIn
{
    public class AccountTypeEdit : AbstractBillPlugIn
    {
        public override void PreOpenForm(PreOpenFormEventArgs e)
        {
            object openType = e.OpenParameter.GetCustomParameter("OperationStatus");
            if (openType != null && openType.ToString().Equals("New", StringComparison.OrdinalIgnoreCase))//自定义参数中存在【操作状态】参数
            {
               
            }
            else if (openType != null && openType.ToString().Equals("Edit", StringComparison.OrdinalIgnoreCase))
            {
              
            }
        }


        public override void DataChanged(DataChangedEventArgs e)
        {
            if (String.Compare(e.Field.Key, "FAuxpropID", true) == 0)
            {

                // 取辅助属性字段值
                DynamicObject auxPropObj = this.Model.GetValue("FAuxPropId", e.Row) as DynamicObject;

                // 取辅助属性中的令/件

                if (auxPropObj != null)
                {

                    try
                    {
                        double lingjian = 0;

                        if (auxPropObj["F100002"] != null)
                        {
                            lingjian = Convert.ToDouble(auxPropObj["F100002"]);
                        }

                        this.Model.SetValue("FLingJian", lingjian, e.Row);
                    }
                    catch
                    {

                        this.View.ShowMessage("输入的零件必须为数值型", MessageBoxType.Notice);

                    }
                }

            }

        }


        }



}
